package com.tjn.date;

import java.time.Instant;
import java.util.Date;

/**
 * @author 陶镓妮
 * @version 1.0
 */
public class Instant_ {
    public static void main(String[] args) {

        //用now()可以获得当前时间戳的对象
        Instant now = Instant.now();
        System.out.println(now);

        //用from()可以把Instant转成Date
        Date date = Date.from(now);
        System.out.println(date);

        //用date的toInstant()可以把date转成Instant对象
        Instant instant = date.toInstant();
        System.out.println(instant);



    }
}
